package match;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class regexpTest {
    public static void main(String[] args) {
//        String s = "da jia ting wo shuo,jin tian yao xia yu,bu shang wan zi xi,gao xing bu?";
//        String regex = "\\b\\w{3}\\b";
//        Pattern p = Pattern.compile(regex);
//        Matcher m = p.matcher(s);
//        while (m.find()) {
//            String group = m.group();
//            System.out.println(m.group());
//        }
        String pattern = "[0-9]+";
        String str = "daf34dfasf43";
        String str1 = new String();
        Pattern p = Pattern.compile(pattern);
        Matcher m = p.matcher(str);
        while (m.find() == true) {
            String s1 = m.group();
            System.out.println(s1);
            str1 = str.replace(s1, "aaa");
        }
        System.out.println(str1);
    }
}
